package com.ly.elasticserach.empty;

import lombok.Data;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.IndexName;
import org.dromara.easyes.annotation.rely.Analyzer;
import org.dromara.easyes.annotation.rely.FieldStrategy;
import org.dromara.easyes.annotation.rely.FieldType;

import java.util.Date;

@Data
@IndexName(value = "easy_es_test",shardsNum = 6,replicasNum = 6)
public class EasyEsTest {
    /**
     * es中的唯一id
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String bookId;


    /**
     * 作者 - KEYWORD类型，不需要分词器，用于精确匹配
     */
    @IndexField(fieldType = FieldType.KEYWORD)
    private String author;

    //查询时用ik_smart 创建索引ik_max_word
    /**
     * 文档标题
     */
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD, searchAnalyzer = Analyzer.IK_SMART)
    private String title;

    /**
     * 文档内容
     */
    @IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_MAX_WORD, searchAnalyzer = Analyzer.IK_SMART)
    private String content;


    @IndexField(value = "create_date",
            fieldType = FieldType.DATE,
            dateFormat = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private Date createDate;
}
